package com.ruoyi.system.mapper.bm;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.system.domain.BaseBanner;
import com.ruoyi.system.domain.bm.BMTeam;

import java.util.List;


/**
 */
public interface BMTeamMapper extends BaseMapper<BMTeam>{


    default List<BMTeam> selectByUserId(Long userid){
        LambdaQueryWrapper<BMTeam> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(BMTeam::getUserId, userid);
        queryWrapper.eq(BMTeam::getIsDeleted, 0);
        return selectList(queryWrapper);
    }

    default BMTeam selectByName(String name,Long contestId){
        LambdaQueryWrapper<BMTeam> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(BMTeam::getName, name);
        queryWrapper.eq(BMTeam::getContestId, contestId);
        queryWrapper.eq(BMTeam::getIsDeleted, 0);
        queryWrapper.last("limit 1");
        return selectOne(queryWrapper);
    }
}

